package com.example.firstdemo.kotlin
fun main() {
   println(ifFunc(100, 200))
   println(whereFunc1(2))
   println(whereFunc2(85))
}

// 1. if语句
fun ifFunc(num1: Int, num2: Int): Int {
    // 写法1:
    //    if(num1 > num2){
    //        return num1
    //    } else {
    //        return num2
    //    }

    // 写法2:
    return if (num1 > num2) num1 else num2
}


fun whereFunc1(num1: Int): String{
   val res = when(num1){
      1 -> "one"
      2 -> "two"
      3 -> "three"
      else -> "other"
   }
   return res
}

fun whereFunc2(score: Int): String = when(score){
    in 90..100 -> "A"
    in 80..89 -> "B"
    in 70..79 -> "C"
    in 60..69 -> "D"
    else -> "F"
}